package com.googlecode.flealancemarket.service.misc.impl;

import com.googlecode.flealancemarket.core.spring.ApplicationContextProvider;
import com.googlecode.flealancemarket.core.spring.ApplicationContextProviderSingleton;
import com.googlecode.flealancemarket.service.misc.BeanLookup;

import org.springframework.context.ApplicationContext;

public class SpringBeanLookup implements BeanLookup {
	
	//for lookuping beans from spring container

	public <T> T getBean(Class<T> clazz) {
		ApplicationContextProvider acp = new ApplicationContextProviderSingleton();
		ApplicationContext ac = acp.getContext();
		return (T) ac.getBean(clazz.getName());
	}

}
